package com.wxyzz.satserver.post.service.impl;

import com.wxyzz.common.core.entity.Post;
import com.wxyzz.common.core.utils.UserUtils;
import com.wxyzz.satserver.post.dao.PostDao;
import com.wxyzz.satserver.post.param.AddPostParam;
import com.wxyzz.satserver.post.service.PostService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * --- 加油，努力 ---
 *
 * @Author XYP
 * @Date 2024/11/21
 * @Solgne 从想做到能做
 * @Desc
 */
@Service
public class PostServiceImpl implements PostService {

    @Resource
    private PostDao postDao;

    /**
     * 发布帖子
     * @param addPostParam
     */
    @Override
    public void addPost(AddPostParam addPostParam) {

        Post post = new Post();
        BeanUtils.copyProperties(addPostParam, post);

        Integer uid = UserUtils.getUid();
        post.setPublisherId(uid);

        postDao.insert(post);

    }



}
